import rxAjax from '@/assets/js/ajax.js';

//对外API接口管理 api接口
export const SysExternalApiApi = {};

SysExternalApiApi.baseUrl = '/api-system/system/core/sysExternalApi';
SysExternalApiApi.exportUrl = SysExternalApiApi.baseUrl + '/listExport';

//查询列表
SysExternalApiApi.query = function (parameter) {
    var url = SysExternalApiApi.baseUrl + '/query';
    return rxAjax.postJson(url, parameter).then(res => {
        return res.result
    })
}

/**
 * 获取单记录
 * @param pkId
 * @returns {*}
 */
SysExternalApiApi.get = function (pkId) {
    var url = SysExternalApiApi.baseUrl + '/get?pkId=' + pkId;
    return rxAjax.get(url);
}

//保存数据
SysExternalApiApi.save = function (parameter) {
    var url = SysExternalApiApi.baseUrl + '/save';
    return rxAjax.postJson(url, parameter);
}

//删除数据
SysExternalApiApi.del = function (parameter) {
    var url = SysExternalApiApi.baseUrl + '/del';
    return rxAjax.postUrl(url, parameter);
}

//生成接口
SysExternalApiApi.genExternalApi = function (parameter) {
    var url = SysExternalApiApi.baseUrl + '/genExternalApi';
    return rxAjax.postForm(url,parameter);
}

//变更分类
SysExternalApiApi.changeCategory=function(ids,categoryId){
    var url= SysExternalApiApi.baseUrl+'/changeCategory';
    return rxAjax.postForm(url, {ids:ids,categoryId:categoryId});
}
export default SysExternalApiApi;